<template>
	<div style="width: 100%;background: #e7e9ee;" :style="{'height':Height+'px'}">
		<iframe id="iframe" :src="srcim" ref="iframe" :style="{'height':Height+'px'}" style="padding-top: 50px;box-sizing: border-box;"></iframe>
		<a @click="to_setting" id="setting"></a>
		<input type="hidden" id="val" value="" />
		<a @click="to_href" id="setting2"></a>
		<rztk  @rzUp="change" ref='child1'></rztk>
	</div>
    
</template>

<script>
	import rztk from './rztk.vue';
    export default {
    	watch: {
    		'$route':'bianhua',
    		imStatus(val){
    			
				
    			
    			
    		},
    	
    	},
    	props:[
            'imStatus'
        ],
        components:{
            rztk
        },
        data: function(){
            return {
            	logintrue:0,
                Height:0,
                srcim:'',
                rzTure:false,
            }
        },
        mounted(){
        	this.Height=document.documentElement.clientHeight;
        	this.srcim='../../../static/web2/index.html?uid='+window.uid+'&&bid=1'
        },
        methods: {
        	bianhua(){
        		if(this.$route.path=='/xiaoxi'){
        			document.getElementById("iframe").contentWindow.parentId2();
        		}
           },
        	change(val){
				this.rzTure=val;
			},
//      	to_close(){
//      		this.$emit('close',true);
//      		document.getElementById("iframe").contentWindow.parentId2();
//      	},
           	to_setting() {
                this.$emit('setting',true);
                localStorage.setItem("imLture","true");
            },
            to_href(){
            	if(this.rzTure){
					let aid =document.getElementById('val').value;
	            	let arr=[];
	            	arr.push(aid);
	            	this.$http.post(this.defines.getImContactsList, {
							'im_identifier':arr
						}, {
							emulateJSON: true
						})
						.then(
							(data) => {
								let messagelis=data.data.data.list[0].uid;
								location.href='../../../static/web/index.html?bid='+messagelis+'&uid='+window.uid
							},
							(error) => {
								this.$message({
						          message: error,
						          type: 'error'
						        });
							}
						);
				}
				else{
					this.$refs.child1.handleParentClick();
				}
            	
            	
            	
            	
            	
            },
//          toload(val){
//          	
//          	window.localStorage.setItem('identifier',this.imObject.imAccount);
//				window.localStorage.setItem('userSig',this.imObject.imSign);
//				window.localStorage.setItem('identifierNick',this.imObject.name);
//				window.localStorage.setItem('headurl',this.imObject.headPic);
//          	if(val.index==1){
//  				
//					if(this.logintrue==0){
//						window.localStorage.setItem('logintrue','1');
//						this.logintrue=1;
//					}
//					else{
//						window.localStorage.setItem('logintrue','0');
//					}
//					if(document.getElementById("iframe").contentWindow.parentId==undefined){
//						let _this=this;
//						setTimeout(function(){_this.toload(val)},1000)
//						return false;
//					}
//					console.log(this.imObject);
//					document.getElementById("iframe").contentWindow.parentId();
//  			}
//  			if(val.index==2){
//  				
//  				if(this.logintrue==0){
//						window.localStorage.setItem('logintrue','1');
//						this.logintrue=1;
//					}
//					else{
//						window.localStorage.setItem('logintrue','0');
//					}
//					window.localStorage.setItem('selToID',val.id);
//					if(document.getElementById("iframe").contentWindow.parentId2==undefined){
//						let _this=this;
//						setTimeout(function(){_this.toload(val)},1000)
//						return false;
//					}
//					document.getElementById("iframe").contentWindow.parentId2();
//  			}
//  			if(val.index==3){
//  				document.getElementById("iframe").contentWindow.parentId3();
//  			}
//          }
        }
    }
</script>

<style scoped>
    #iframe{
    	width: 100%;
    	height: 100%;
    	border: 0;
    }
   
</style>